<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
  <head>
    <title>批号管理</title>
    <jsp:include page="header.jsp"></jsp:include>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">内容管理</a>
        <a>
          <cite>批号管理</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
     <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" action="/admin/pihaoList" method="post" id="listForm">
    	<div class="layui-col-md10">
      	  <input type="text" name="name"  placeholder="请输入药品名称" autocomplete="off" class="layui-input">
          <input type="hidden" name="start" id="hh"/> 
          <button class="layui-btn"><i class="layui-icon">&#xe615;</i></button>
    	</div>
        </form>
      </div>
      <xblock>
   <button class="layui-btn" onclick="x_admin_show('增加批号','/admin/toPihaoAdd',600,500)"><i class="layui-icon"></i>添加</button>
        <span class="x-right" style="line-height:40px">共有数据：${total} 页</span>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            <th>ID</th>
            <th>药品批号</th>
            <th>检验报告</th>
            <th>商品名称</th>
            <th>操作</th></tr>
        </thead>
        <tbody>
        <c:if test="${not empty list}">
      	<c:forEach var="app" items="${list}" varStatus="st">
          <tr>
            <td>
              <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
	            </td>
	            <td>${st.index +1}</td>
	            <td>${app.piName}</td>
	            <td><img src="${pageContext.request.contextPath }${app.piReport}" alt="" width="70" height="50" /></td>
	            <td>${app.piDetail}</td>
	            <td class="td-manage">
	              <a title="编辑"  onclick="x_admin_show('编辑','/admin/toPihaoAdd?id=${app.id}',600,400)" href="javascript:;">
	                <i class="layui-icon">&#xe642;</i>
	              </a>
	              <a title="删除" onclick="member_del(this,'${app.id}')" href="javascript:;">
	                <i class="layui-icon">&#xe640;</i>
	              </a>
	            </td>
          </tr>
          </c:forEach>
	      </c:if>
        </tbody>
      </table>
      <div class="page">
        <div>
          <a class="my-first" href="javascript:;">
          	首页</a>
          <a class="prev" href="javascript:;">上一页</a>
          <a class="next" href="javascript:;">下一页</a>
          <a class="my-last" href="javascript:;">末页</a>
        </div>
      </div>

    </div>
    <script>
      /*用户-删除*/
      function member_del(obj,id){
    	  layer.confirm('您确定删除这条记录吗？', {
    		  btn: ['确实','取消'] //按钮
    		}, function(){
    			$.get("/admin/pihaoDel?id="+id, function(data){
    				if("ok"==data){
    					layer.msg('删除成功!', {icon: 1});
    					location.reload();
    				}else{
    					layer.msg('删除失败!', {icon: 1});
    				}
    				  //alert("Data Loaded: " + data);
    				});
    		}, function(){
    		  layer.msg('您取消了操作!', {
    		    time: 200
    		  });
    		});
      }
		$('.my-first').click(function(){
			var page =${page};
			if(page>1){
				$("#hh").val(1);
				$("#listForm").submit();
			}
		});
		$('.prev').click(function(){
			var page =${page};
			if(page>=2){
				$("#hh").val(page-1);
				$("#listForm").submit();
			}
		});
		$('.next').click(function(){
			var page =${page};
			var total=${total};
			if(total>=2){
				$("#hh").val(page+1);
				$("#listForm").submit();
			}
		});
		$('.my-last').click(function(){
			var page =${page};
			var total=${total};
			if(total>=2){
				$("#hh").val(total);
				$("#listForm").submit();
			}
		});
		
    </script>
    
  </body>

</html>